# \project_v1\app\models\request.py
from sqlalchemy import Column, String, Integer
from app.models.base import Base
from flask_sqlalchemy import SQLAlchemy

db = SQLAlchemy()

class Request(Base):
    RequestID = Column(Integer, primary_key=True, autoincrement=True)#申请id 主键
    U_ID = Column(Integer, nullable=True)  # 根据需要调整长度 外键申请人ID
    M_ID = Column(Integer, nullable=True)#外键 药材表id
    Explanation = Column(String(3000), nullable=True)#申请理由
    #ScoreUpdateCount = Column(Integer, nullable=True)  # 根据需要调整长度
    Request_Type = Column(String(20), nullable=False)  # ADD_COURSE, UPDATE_SCORE
    Approve_Type = Column(String(20), nullable=False)  # 三种状态wait, reject, pass
   


    def __init__(self, RequestID=None, U_ID=None,M_ID=None,  Explanation=None, Request_Type=None, Approve_Type='wait',T_id=None):
        super(Request, self).__init__()
        self.RequestID = RequestID
        self.U_ID = U_ID
        self.M_ID = M_ID
        self.Explanation = Explanation
        #self.ScoreUpdateCount = ScoreUpdateCount
        self.Request_Type = Request_Type
        self.Approve_Type = Approve_Type
    
